from selenium.webdriver.common.by import By

class CouponMyCouponLocator:
    # My Coupon菜单
    my_coupon_menu = (By.CSS_SELECTOR, '[path="/work_bench/coupon/myCoupon"]')

    #bind coupon按钮
    bind_coupon_button = (By.XPATH, '//button//span[text() = "Bind Coupon"]')

    #绑定coupon的输入框
    bind_coupon_input = (By.XPATH, "//input[contains(@placeholder,'Please enter Coupon No..')]")

    #绑定coupon的输入框
    ok_button = (By.XPATH, '//button/span[text() = "OK"]')

    # My Coupon列表属性
    my_coupon_list_no = (By.XPATH, '//*[@id="root"]/section/section/main/div/main/div/div/div/div[2]/div[2]/div/div/div/div/div/table/thead/tr/th[1]')
    my_coupon_list_status = (By.XPATH, '//*[@id="root"]/section/section/main/div/main/div/div/div/div[2]/div[2]/div/div/div/div/div/table/thead/tr/th[2]/div/span[1]')
    my_coupon_list_template = (By.XPATH, '//*[@id="root"]/section/section/main/div/main/div/div/div/div[2]/div[2]/div/div/div/div/div/table/thead/tr/th[3]')
    my_coupon_list_useable_product = (By.XPATH, '//*[@id="root"]/section/section/main/div/main/div/div/div/div[2]/div[2]/div/div/div/div/div/table/thead/tr/th[4]')
    my_coupon_list_percent = (By.XPATH, '//*[@id="root"]/section/section/main/div/main/div/div/div/div[2]/div[2]/div/div/div/div/div/table/thead/tr/th[5]')
    my_coupon_list_fixed_amount = (By.XPATH, '//*[@id="root"]/section/section/main/div/main/div/div/div/div[2]/div[2]/div/div/div/div/div/table/thead/tr/th[6]')
    my_coupon_list_deducted = (By.XPATH, '//*[@id="root"]/section/section/main/div/main/div/div/div/div[2]/div[2]/div/div/div/div/div/table/thead/tr/th[7]')
    my_coupon_list_balance = (By.XPATH, '//*[@id="root"]/section/section/main/div/main/div/div/div/div[2]/div[2]/div/div/div/div/div/table/thead/tr/th[8]')
    my_coupon_list_reuse = (By.XPATH, '//*[@id="root"]/section/section/main/div/main/div/div/div/div[2]/div[2]/div/div/div/div/div/table/thead/tr/th[9]')
    my_coupon_list_period = (By.XPATH, '//*[@id="root"]/section/section/main/div/main/div/div/div/div[2]/div[2]/div/div/div/div/div/table/thead/tr/th[10]')

    # 搜索框
    search_input = (By.XPATH, "//input[contains(@placeholder,'Coupon Template/Coupon No.')]")
    # 搜索按钮
    search_button = (By.XPATH, "//button[contains(@class,'antd4-btn antd4-btn-default antd4-btn-icon-only antd4-input-search-button')]")

    # 第一个查询结果
    first_search_result = (By.XPATH, '(//tr[contains(@class,"antd4-table-row antd4-table-row-level-0")])[1]//td[1]')
    # 第一个查询结果的coupon template的值
    first_search_result_coupon_template = (By.XPATH, '(//tr[contains(@class,"antd4-table-row antd4-table-row-level-0")])[1]//td[3]')
    # 第一个查询结果的status的值
    first_search_result_status = (By.XPATH, '(//tr[contains(@class,"antd4-table-row antd4-table-row-level-0")])[1]//td[2]')

    #状态筛选按钮
    status_filter_button = (By.XPATH, "//span[contains(@class,'antd4-dropdown-trigger antd4-table-filter-trigger')]")
    status_filter_valid_button = (By.XPATH, '(//input[contains(@class,"antd4-checkbox-input")])[1]')
    status_filter_exhausted_button = (By.XPATH, '(//input[contains(@class,"antd4-checkbox-input")])[2]')
    status_filter_expired_button = (By.XPATH, '(//input[contains(@class,"antd4-checkbox-input")])[3]')
    status_filter_ok_button = (By.XPATH, '//button[contains(@class,"antd4-btn antd4-btn-primary antd4-btn-sm")]//span[text()="OK"]')
    status_filter_reset_button = (By.XPATH, '//span[text()="Reset"]')

